<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/share/taglib.jsp" %>
<%  String path = request.getContextPath(); %>
<html><head>
<title>按院校选择专业</title>
 <script type="text/javascript" src="<%=path%>/script/jquery-1.3.2.min.js"></script>
<link href="<%=path%>/style/imitation.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="<%=path%>/images/comm_fns.js"></script>
<script language="javascript">
var majorNum = 0;
var selMajorNum = 3;
function chg_msort(oMajorCheckBox)
{
	var majorId = oMajorCheckBox.value;
	var disSort = !oMajorCheckBox.checked;
	
	if (!disSort)
	{
		oMajorCheckBoxs = document.getElementsByName('majorid[]');
		//document.form1.majorid.length;
		majorNum = oMajorCheckBoxs.length;
		chkedNum = 0;
		for (var i=0; i<majorNum; i++)
		{
			if (oMajorCheckBoxs[i].checked)
			{
				chkedNum++;
			}
			if (chkedNum>selMajorNum-1)
			{
				chg_mCheckBoxes(0);
				//alert('您最多只能选择'+selMajorNum-1+'个专业');
				//oMajorCheckBox.checked = false;
				break;
			}
		}
	}
	else
	{
		chg_mCheckBoxes(1);
	}

	oSortRadios = document.getElementsByName('msort_' + majorId);
	for (var i=0; i<3; i++)
	{
		oSortRadios[i].disabled = disSort;
		if (disSort && oSortRadios[i].checked) {oSortRadios[i].checked  = false;}
	}
}

function chg_mCheckBoxes(value)
{
	oMajorCheckBoxs = document.getElementsByName('majorid[]');
	majorNum = oMajorCheckBoxs.length;
	for (var i=0; i<majorNum; i++)
	{
		if (!oMajorCheckBoxs[i].checked)
		{
			oMajorCheckBoxs[i].disabled = !value;
		}
	}
}

function chk_msort(myMajorId,mySort)
{
	oMajorCheckBoxs = document.getElementsByName('majorid[]');
	majorNum = oMajorCheckBoxs.length;
	for (var i=0; i<majorNum; i++)
	{
		
		if (oMajorCheckBoxs[i].value != myMajorId)
		{
			oSortRadios = document.getElementsByName('msort_' + oMajorCheckBoxs[i].value);
			if (oSortRadios[mySort-1].checked)
			{
				oSortRadios[mySort-1].checked = false;
			}
		}
	}
	return true;
}


function chkSubmit()
{
	oMajorCheckBoxs = $n('majorid[]');
	if (!chkRadio('majorid[]'))
	{
		alert('请至少选择一个专业！');
		return false;
	}
	
	majorNum = oMajorCheckBoxs.length;
	for (var i=0; i<majorNum; i++)
	{
		if (oMajorCheckBoxs[i].checked)
		{
			var chkSortOK = false;
			oSortRadios = $n('msort_' + oMajorCheckBoxs[i].value);
			for (var j=0; j<3; j++)
			{
				if(oSortRadios[j].checked)
				{
					chkSortOK = true;
					break;
				}
			}
			if (!chkSortOK)
			{
				alert('请选择专业优先次序！');
				oSortRadios[0].focus();
				return false;				
			}
		}
	}	
	return true;
}
</script>
</head>
<body leftmargin="0" bgcolor="#FFFFFF" marginwidth="0">
<center>
	<jsp:include page="/head.jsp"/>

  <table bgcolor="#B1DE9B" border="0" cellpadding="0" cellspacing="0" width="950">
    <tbody><tr>
      <td align="center" height="50"><img src="<%=path%>/images/tbzy.gif" height="19" width="69"></td>
    </tr>
  </tbody></table>
  <table border="0" cellpadding="0" cellspacing="0" width="950">
    <tbody><tr>
      <td rowspan="2" bgcolor="#B1DE9B" width="8"></td>
      <td align="center" bgcolor="#EBF7E6" height="36"><b style="color:#274401;font-size:14px;">填报志愿流程向导</b></td>
      <td rowspan="2" bgcolor="#B1DE9B" width="8"></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#EBF7E6"><table style="margin-bottom: 20px;" border="0" cellpadding="0" cellspacing="0">
          <tbody><tr>
            <td rowspan="3" align="center"><table border="0" cellpadding="0" cellspacing="0">
                <tbody><tr>
                  <td align="center" background="<%=path%>/images/mn_sc2_03.gif" height="72" width="95"><font color="#274402">输入预估分</font></td>
                </tr>
            </tbody></table></td>
            <td rowspan="3" align="center" width="82"><img src="<%=path%>/images/mn_sc1_05.gif" height="39" width="58"></td>
            <td align="center" background="<%=path%>/images/mn_sc1_06.gif" height="33" width="144"><font color="#274402">按预估分选择院校</font></td>
            <td rowspan="3" align="center" width="40"><img src="<%=path%>/images/mn_zy1_01.gif" height="49" width="26"></td>
            <td align="center" background="<%=path%>/images/mn_sc3_01.gif" height="33" width="144"><b style="color:#034A8C">按院校选择专业</b></td>
            <td rowspan="3" align="center" width="82"><img src="<%=path%>/images/mn_sc1_07.gif" height="39" width="59"></td>
            <td rowspan="3" align="center"><table border="0" cellpadding="0" cellspacing="0">
                <tbody><tr>
                  <td class="l15" align="center" background="<%=path%>/images/mn_sc2_03.gif" height="72" width="95"><font color="#274402">添加一个志愿<br>
到志愿表</font></td>
                </tr>
            </tbody></table></td>
          </tr>
          <tr>
            <td align="center"></td>
            <td height="10"></td>
          </tr>
          <tr>
            <td align="center" background="<%=path%>/images/mn_sc1_06.gif" height="33" width="144"><font color="#274402">按预估分选择专业</font></td>
            <td align="center" background="<%=path%>/images/mn_sc1_06.gif" height="33" width="144"><font color="#274402">按专业选择院校</font></td>
          </tr>
      </tbody></table></td>
    </tr>
  </tbody></table>
  <s:form action="wishlist_yxzyresult" namespace="/front" method="post" id="wishlistfornm" onsubmit="">
  <table bgcolor="#B1DE9B" border="0" cellpadding="0" cellspacing="0" width="950">
    <tbody><tr align="center">
      <td colspan="4" height="8"></td>
    </tr>
    <tr>
      <td rowspan="4" width="8"></td>
      <td align="center" bgcolor="#FFFFFF" width="934"><table style="margin-bottom: 10px; margin-top: 20px;" align="right" border="0" cellpadding="0" cellspacing="0" width="87%">
        <tbody><tr>
          <td align="center"><font color="#FF6600">说明：选择专业后，点击进入下一步。最多可同时选择三个专业。
            
          </font></td>
          <td align="center" width="13%">              <input name="" src="<%=path%>/images/mn_zy2_02.gif" type="image" onClick="return chkSubmit()"></td></tr>
      </tbody></table></td>
      <td rowspan="4" width="8"></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF"><table style="margin-bottom: 20px;" border="0" cellpadding="0" cellspacing="0">
        <tbody>
       
        <tr>
          <td align="center" height="26"><b style="color:#ff6600;font-size:14px;"><c:out  value="${sessionScope.yxmc}"/> <c:out value='${pcname}'/> <c:out value='${klmc}'/> </b>　<b style="color:#274401;font-size:14px;">专业列表</b></td>
        </tr>
      </tbody></table></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF">
        <table bgcolor="#8AC876" border="0" cellpadding="0" cellspacing="1" width="800">
          <tbody><tr align="center" bgcolor="#B1DE9B">
              <td height="30" width="80"><b>专业大类</b></td>
              <td width="200"><b>专业名称</b></td>
              <td width="60"><b>选择</b></td>
              <td width="260"><strong>专业次序</strong></td>
          </tr>
          
           <c:forEach items="${zyList}" var="entry">
	          <tr align="center" bgcolor="#FFFFFF">
            <td align="center" bgcolor="#C6E7B9" height="30"><font color="#274402"><c:out value='${entry.zydlmc}'/></font></td>
            <input type="hidden" name="zymc_<c:out value='${entry.zydh}'/>" value="<c:out value='${entry.zymc}'/>"/>"
            <td style="padding-left: 5px;" align="left" bgcolor="#EBF7E6"><a href="http://exam.edu.sina.com.cn/collegedb/collegemajor_detail.php?collegeid=10650&amp;majorid=12892" target="_blank" class="a06"><c:out value='${entry.zymc}'/></a></td>
            <td><input name="majorid[]" id="majorid" value="<c:out value='${entry.zydh}'/>" onclick="chg_msort(this);" type="checkbox">
              <!--<select name="majorsort[]">
              <option selected>选择次序</option>
			   <option value="1">第一专业</option> 
			   <option value="2">第二专业</option> 
			   <option value="3">第三专业</option>
            </select>--></td>
            <td><input name="msort_<c:out value='${entry.zydh}'/>" id="msort_<c:out value='${entry.zydh}'/>" value="1" disabled="disabled" onclick="chk_msort('<c:out value='${entry.zydh}'/>',this.value);" type="radio">
              第一专业
                <input name="msort_<c:out value='${entry.zydh}'/>" id="msort_<c:out value='${entry.zydh}'/>" value="2" disabled="disabled" onclick="chk_msort('<c:out value='${entry.zydh}'/>',this.value);" type="radio">
                第二专业
                <input name="msort_<c:out value='${entry.zydh}'/>" id="msort_<c:out value='${entry.zydh}'/>" value="3" disabled="disabled" onclick="chk_msort('<c:out value='${entry.zydh}'/>',this.value);" type="radio">
                第三专业                </td>
          </tr>
          </c:forEach>
          
          
	         
	        </tbody></table>
      </td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF"><table style="margin-bottom: 20px; margin-top: 20px;" align="right" border="0" cellpadding="0" cellspacing="0" width="87%">
        <tbody><tr>
          <td align="center"><font color="#FF6600">说明：选择专业后，点击进入下一步。最多可同时选择三个专业。</font></td>
          <td align="center" width="13%"><input name="" src="<%=path%>/images/mn_zy2_02.gif" type="image" onClick="return chkSubmit()"></td>
        </tr>
		
      </tbody></table></td>
    </tr>
	
  </tbody></table>
  </s:form>
  <table border="0" cellpadding="0" cellspacing="0" width="950">
    <tbody><tr align="center" bgcolor="#B1DE9B">
      <td height="90" width="950"><a href="<%=path%>/front/wishlist_back.action"><img src="<%=path%>/images/mn_zy5_01.gif" border="0" height="19" width="63"></a></td>
    </tr>
  </tbody></table>
  <jsp:include page="/foot.jsp"/>

</center>
</body></html>